ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
freemaster.h File Reference

FreeMASTER Driver main API header file, MPC56xx platform. More...

#include "freemaster_defcfg.h"
#include "freemaster_tsa.h"

Go to the source code of this file.

Defines

#define FMSTR_PLATFORM_MPC56xx   1
#define FMSTR_APPCMDRESULT_NOCMD   0xff
#define FMSTR_APPCMDRESULT_RUNNING   0xfe
#define MFSTR_APPCMDRESULT_LASTVALID   0xf7
#define FMSTR_REC_BASE_SECONDS(x)   ((x) & 0x3fff)
#define FMSTR_REC_BASE_MILLISEC(x)   (((x) & 0x3fff) | 0x4000)
#define FMSTR_REC_BASE_MICROSEC(x)   (((x) & 0x3fff) | 0x8000)
#define FMSTR_REC_BASE_NANOSEC(x)   (((x) & 0x3fff) | 0xc000)
#define NULL   ((void *) 0)

Typedefs

typedef unsigned char * FMSTR_ADDR
typedef unsigned short FMSTR_SIZE
typedef signed long FMSTR_BOOL
typedef unsigned char FMSTR_APPCMD_CODE
typedef unsigned char FMSTR_APPCMD_DATA
typedef unsigned char * FMSTR_APPCMD_PDATA
typedef unsigned char FMSTR_APPCMD_RESULT
typedef FMSTR_APPCMD_RESULT(* FMSTR_PAPPCMDFUNC )(FMSTR_APPCMD_CODE, FMSTR_APPCMD_PDATA, FMSTR_SIZE)

Functions

FMSTR_BOOL FMSTR_Init (void)
 FreeMASTER driver initialization.
void FMSTR_Poll (void)
void FMSTR_Isr (void)
void FMSTR_Recorder (void)
 API: Recorder worker routine - can be called from application's timer ISR.
void FMSTR_TriggerRec (void)
 API: Pull the trigger of the recorder.
void FMSTR_SetUpRecBuff (FMSTR_ADDR nBuffAddr, FMSTR_SIZE nBuffSize)
 API: Replacing the recorder buffer with the user's one.
FMSTR_APPCMD_CODE FMSTR_GetAppCmd (void)
 API: Fetch the application command code if one is ready for processing.
FMSTR_APPCMD_PDATA FMSTR_GetAppCmdData (FMSTR_SIZE *pDataLen)
 API: Get a pointer to application command data.
FMSTR_BOOL FMSTR_RegisterAppCmdCall (FMSTR_APPCMD_CODE nAppCmdCode, FMSTR_PAPPCMDFUNC pCallbackFunc)
 API: Register or unregister app.cmd callback handler.
void FMSTR_AppCmdAck (FMSTR_APPCMD_RESULT nResultCode)
 API: Mark the application command is processed by the application.
void FMSTR_AppCmdSetResponseData (FMSTR_ADDR nResultDataAddr, FMSTR_SIZE nResultDataLen)
 API: Mark the application command is processed by the application.

Detailed Description

FreeMASTER Driver main API header file, MPC56xx platform.

Version:
1.0.5.0
Date:
Aug-10-2011

This is the only header file needed to be included by the user application to implement the FreeMASTER interface. In addition, user has to write her "freemaster_cfg.h" configuration file and put it anywhere on the #include path


Function Documentation

void FMSTR_AppCmdAck ( FMSTR_APPCMD_RESULT  nResultCode)

API: Mark the application command is processed by the application.

Parameters:
nResultCode- the result code which is returned to a host
void FMSTR_AppCmdSetResponseData ( FMSTR_ADDR  nResultDataAddr,
FMSTR_SIZE  nResultDataLen 
)

API: Mark the application command is processed by the application.

Parameters:
pResultDataAddr- address of data we want to return to the PC
nResultDataLen- length of return data
FMSTR_APPCMD_CODE FMSTR_GetAppCmd ( void  )

API: Fetch the application command code if one is ready for processing.

Returns:
A command code stored in the application cmd buffer. The return value is FMSTR_APPCMDRESULT_NOCMD if there is no new command since the last call to FMSTR_AppCmdAck
FMSTR_APPCMD_PDATA FMSTR_GetAppCmdData ( FMSTR_SIZE *  pDataLen)

API: Get a pointer to application command data.

Parameters:
pDataLen- A pointer to variable which receives the data length
Returns:
Pointer to the "application command" data
void FMSTR_Recorder ( void  )

API: Recorder worker routine - can be called from application's timer ISR.

This returns quickly if recorder is not running, otherwise it calls quite lengthy recorder routine which does all the recorder work (sampling, triggering)

FMSTR_BOOL FMSTR_RegisterAppCmdCall ( FMSTR_APPCMD_CODE  nAppCmdCode,
FMSTR_PAPPCMDFUNC  pCallbackFunc 
)

API: Register or unregister app.cmd callback handler.

Parameters:
nAppCmdCode- App.command ID
pCallbackFunc- Pointer to handler function (NULL to unregister)
Returns:
Non-zero if successfull, zero if maximum callbacks already set
void FMSTR_SetUpRecBuff ( FMSTR_ADDR  pBuffer,
FMSTR_SIZE  nBuffSize 
)

API: Replacing the recorder buffer with the user's one.

Parameters:
pBuffer- user buffer pointer
wBuffSize- buffer size
Note:
Use the FMSTR_SetUpBuff32 to pass the forced 32bit address in SDM
void FMSTR_TriggerRec ( void  )

API: Pull the trigger of the recorder.

This function starts the post-trigger stop countdown